<!doctype html>
<html>
<head>
	<title>Title</title>
	<meta charset="utf-8">
</head>

<?php
	
$path = __DIR__."/../../../";
require_once($path.'_inc/app.php');

$genre = Db::getModel("genre");

//получаем страницу
$data = file_get_contents("http://www.loveread.ec/index.php?id_genre=1");
 $data = iconv("windows-1251", "UTF-8", $data);

 preg_match_all ("/id_genre=(\d+)\"\stitle=\"([^\"]+)/", $data ,$out);

_d($out);

foreach($out[0] as $k=>$v){
	$data = null;
	$data = array('id'=>$out[1][$k],"title"=>$out[2][$k]);
	$genre->insert($data,false,false);
}
?>
</body>
</html>
